export class Mathes {
  @log
  add(a, b) {
    return a + b;
  }
}
function log(target, name, descriptor) {
  const oldValue = descriptor.value;
  descriptor.value = function () {
    console.log(`Calling ${name} with`, arguments);
    return oldValue.apply(this, arguments);
  };
  return descriptor;
}
export const debounce = (fn, delay) => {
  let timer = null;
  return function (args) {
    const self = this;
    timer && clearTimeout(timer);
    timer = setTimeout(() => {
      fn.call(self, args);
    }, delay);
  };
};
